<template>
	<view>
		<view class="news-details">
			<view class="main">
				<u-parse :html="article_content" :tag-style="tagStyle" />
			</view>
		</view>
		<loading-view v-if="showLoading"></loading-view>
	</view>
</template>

<script>

	import {
		getWebSiteConfig
	} from '@/api/app';

	export default {
		data() {
			return {
				showLoading: true,
				articleDetail: {},
				article_content: "",
				tagStyle: {
					img: 'width:100%;'
				}
			};
		},

		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad: function(options) {
			this.class = options.class || '';
			this.key = options.key;
			this.title = options.title;
			// #ifdef H5
			window.document.title = options.title;
			// #endif
			this.getWebSiteConfigFun();
		},


		methods: {
			getWebSiteConfigFun() {
				getWebSiteConfig({
					class: this.class,
					key: this.key
				}).then(res => {
					if (res.code == 1) {
						this.articleDetail = res.data
						//wxParse.wxParse('content', 'html', res.data.content, this, 15)
						setTimeout(() => {
							this.article_content = res.data;
						}, 200);
						setTimeout(() => {
							this.showLoading = false
						}, 300);
					}
				});
			}

		}
	};
</script>
<style>
	/* pages/news_details/news_details.wxss */
	page {
		background-color: #fff;
	}

	.news-details .header {
		padding: 20rpx 15px;
		border-bottom: var(--border);
	}

	.news-details .main {
		padding: 40rpx 15px;
	}

	.wxParse-p image {
		width: 100%;
	}
</style>
